<template>
    <div class="body mycus">
        <div class="header">
            <a @click="turntabId(9)" :class="{ active: tabId == 9 }">全部</a>
            <a @click="turntabId(0)" :class="{ active: tabId == 0 }"
                >意向客户</a
            >
            <a @click="turntabId(1)" :class="{ active: tabId == 1 }"
                >报件客户</a
            >
            <a @click="turntabId(2)" :class="{ active: tabId == 2 }">已完成</a>
        </div>
        <div class="cuslist" ref="cusref">
            <div v-show="tabId === 9">
                <ul>
                    <dl
                        v-for="(item, index) in odata"
                        @click="turndetial(item.oid, item.oType)"
                        :key="index"
                    >
                        <dd><img :src="item.authorImg" alt="" /></dd>
                        <dt>
                            <p>
                                <i>{{ item.authname }}</i
                                ><i>{{ item.time }}</i>
                            </p>
                            <p>
                                <span>{{ item.zijin }}</span>
                            </p>
                        </dt>
                    </dl>
                    <dl class="addmore" @click="addmoreclick">{{ addmore }}</dl>
                </ul>
            </div>
            <div v-show="tabId === 0">
                <ul>
                    <dl
                        v-for="(item, index) in odata"
                        @click="turndetial(item.oid, item.oType)"
                        :key="index"
                    >
                        <dd><img :src="item.authorImg" alt="" /></dd>
                        <dt>
                            <p>
                                <i>{{ item.authname }}</i
                                ><i>{{ item.time }}</i>
                            </p>
                            <p>
                                <span>{{ item.zijin }}</span>
                            </p>
                        </dt>
                    </dl>
                    <dl class="addmore" @click="addmoreclick">{{ addmore }}</dl>
                </ul>
            </div>
            <div v-show="tabId === 1">
                <ul>
                    <dl
                        v-for="(item, index) in odata"
                        @click="turndetial(item.oid, item.oType)"
                        :key="index"
                    >
                        <dd><img :src="item.authorImg" alt="" /></dd>
                        <dt>
                            <p>
                                <i>{{ item.authname }}</i
                                ><i>{{ item.time }}</i>
                            </p>
                            <p>
                                <span>{{ item.zijin }}</span>
                            </p>
                        </dt>
                    </dl>
                    <dl class="addmore" @click="addmoreclick">{{ addmore }}</dl>
                </ul>
            </div>
            <div v-show="tabId === 2">
                <ul>
                    <dl
                        v-for="(item, index) in odata"
                        @click="turndetial(item.oid, item.oType)"
                        :key="index"
                    >
                        <dd><img :src="item.authorImg" alt="" /></dd>
                        <dt>
                            <p>
                                <i>{{ item.authname }}</i
                                ><i>{{ item.time }}</i>
                            </p>
                            <p>
                                <span>{{ item.zijin }}</span>
                            </p>
                        </dt>
                    </dl>
                    <dl class="addmore" @click="addmoreclick">{{ addmore }}</dl>
                </ul>
            </div>
        </div>
    </div>
</template>

<script>
import { Toast } from "mint-ui";
export default {
    name: "customer",
    data() {
        return {
            odata: [],
            tabId: 9,
            addmore: "暂无更多",
            pagenum: 0
        };
    },
    created() {},
    mounted() {
        if (sessionStorage.tabIerd) {
            this.tabId = Number(sessionStorage.tabIerd);
        }
        this.common.getCuslist(this, this.tabId, 0, 10);
    },
    methods: {
        turntabId(id) {
            this.tabId = id;
            this.pagenum = 0;
            this.odata = [];
            this.addmore = "暂无更多";
            this.common.getCuslist(this, this.tabId, 0, 10);
        },
        turndetial(a, b) {
            this.$router.push("/userEntry?id=" + a + "&type=" + b);
            // if (b == 0) {
            //     this.$router.push("/CusYixiang?id=" + a);
            // } else {
            //     this.$router.push("/CusBaojian?id=" + a);
            // }
        },
        addmoreclick() {
            this.pagenum++;
            if (this.addmore == "加载更多...") {
                this.common.getCuslist(this, this.tabId, this.pagenum, 10);
            }
        }
    }
};
</script>

<style scoped lang="less">
@import "../style/userLister.less";
.mycus {
    background: #f4f4f4;

    .cuslist {
        background: #fff;
        margin-top: 0.2rem;
        div {
            margin-top: 1.2rem;
        }
    }

    .header {
        height: 1rem;
        width: 100%;
        background: #fff;
        position: fixed;
        top: 0;
        left: 0;
        .active {
            color: #105ffe;
            border-bottom: 0.06rem solid #105ffe;
        }
        a {
            display: block;
            height: 0.94rem;
            float: left;
            line-height: 1rem;
            border-bottom: 0.06rem solid transparent;
            text-align: center;
            width: 20%;
            margin: 0 2.5%;
        }
    }
}
</style>
